package Week1.J0415;

//计算在两个整数范围内，所有数字中包含数字2的次数

import java.util.Scanner;

public class NumCounting {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int start = scanner.nextInt();
        int end = scanner.nextInt();
        int count = 0;

        for (int i = start; i <= end; i++) {
            int tmp = i;
            while (tmp > 0) {
                int rem = tmp % 10;
                if (rem == 2) {
                    count++;
                }
                tmp /= 10;
            }
        }
        System.out.println(count);
    }
}
